#ifndef INGREDIENT_H
#define INGREDIENT_H
#include <string>
class Ingredient
{
public:
    double get_price_unit() {
        return price_unit;
    } ;
    size_t get_units() {
        return units;
    };
    virtual std::string get_name() = 0;

    double price() {
        return units * price_unit;
    };
    virtual ~Ingredient() = default;
protected:
    Ingredient(double price_unit, size_t units)
    : price_unit(price_unit) , units(units) {};

    double price_unit;
    size_t units;
    std::string name;
};

#define DEF_SUB_INGREDIENT(iname,iprice) \
class iname : public Ingredient { \
public: \
    iname(size_t units) : Ingredient{iprice, units} \
    { \
        this->name = #iname ;\
    }\
\
    virtual std::string get_name() {return this->name;}\
    virtual ~iname() = default; \
}

#endif // INGREDIENT_H